﻿using System;
using System.Collections.Generic;
using System.Linq;
using Model.Database;

namespace Bll
{
    public partial class PowerBll
    {
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="idArr"></param>
        public void ListDelete(string[] idArr)
        {
            CurrentDal.Delete(a => idArr.Contains(a.PowerId));
            CurrentDalSession.SaveChanges();
        }

        /// <summary>
        ///  获取集合通过Id数组
        /// </summary>
        /// <param name="powerIdArr"></param>
        /// <returns></returns>
        public List<Power> GetPowerListByIdArr(string[] powerIdArr)
        {
            return CurrentDal.GetIQueryable().Where(a => powerIdArr.Contains(a.PowerId)).ToList();
        }

        /// <summary>
        /// 获取所有_异步
        /// </summary>
        /// <returns></returns>
        public List<Power> GetList_Async()
        {
            return CurrentDalSession.TimelyDbContext.Powers.ToList();
        }
    }
}
